package com.lanchetech.dao;

import com.lanchetech.bean.vo.ChatVO;
import com.lanchetech.entity.Msg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface MsgMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Msg record);

    int insertSelective(Msg record);

    Msg selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Msg record);

    int updateByPrimaryKey(Msg record);

    List<Msg> findAllList(@Param("chatId") String chatId, @Param("endTime") Date endTime);

    List<ChatVO> findAllFriend(Long userId);

    int updateIsReadByFromIdAndToIdAndIsRead(@Param("updatedIsRead")Byte updatedIsRead,@Param("fromId")Long fromId,@Param("toId")Long toId,@Param("isRead")Byte isRead);

    Long countByIsReadAndToId(@Param("isRead")Byte isRead,@Param("toId")Long toId);

    int updateIsReadById(@Param("updatedIsRead")Byte updatedIsRead,@Param("id")Long id);

    Msg findOneLastByTenantIdAndFromId(@Param("tenantId")Long tenantId,@Param("fromId")Long fromId);

    Msg findOneLastByPlatformAndFromId(@Param("fromId")Long fromId);


}